<div class="builder listbuilder-box">
    {// 额外功能代码top }
    <?php if(isset($extra_html['top'])): ?>
        {$extra_html['top']}
    <?php endif; ?>

    <!-- Tab导航 -->
    <notempty name="tab_nav">
        <div class="builder-tabs">
            <div class="row">
                <div class="col-xs-12">
                    <ul class="nav nav-tabs">
                        <volist name="tab_nav.tab_list" id="tab">
                            <li class="<php>if($tab_nav['current_tab'] == $key) echo 'active';</php>"><a href="{$tab.href}">{$tab.title}</a></li>
                        </volist>
                    </ul>
                </div>
            </div>
        </div>
        <div class="form-group"></div>
    </notempty>

    <!-- 顶部工具栏按钮 -->
    <div class="builder-toolbar">
        <div class="row">
            <!-- 工具栏按钮 -->
            <notempty name="top_button_list">
                <div class="col-xs-12 col-sm-8 button-list clearfix">
                    <div class="form-group">
                        <volist name="top_button_list" id="button">
                            <?php if(isset($button['type']) && $button['type'] === 'dropdown'): ?>
                                <div class="btn-group">
                                    <button type="button" class="{$button.class|default=''} dropdown-toggle" data-toggle="dropdown">
                                        {$button.title|default=''}
                                        <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <volist name="button.dropdown" id="btn">
                                            <li><a class="{$btn.class|default=''}" href="{$btn.href|default=''}">{$btn.title}</a></li>
                                        </volist>
                                    </ul>
                                </div>
                            <?php else: ?>
                                <a {$button.attribute|default=''}>{$button.title|default=''}</a>&nbsp;
                            <?php endif; ?>
                        </volist>
                    </div>
                </div>
            </notempty>

            <!-- 搜索框 -->
            <notempty name="search">
                <empty name="search_form_items">
                    <div class="col-xs-12 col-sm-4 clearfix">
                        <form class="form" method="get" action="{$search.url}">
                            <div class="form-group">
                                <div class="input-group search-form">
                                    <input type="text" name="keyword" class="search-input form-control" value="{:I('get.keyword')}" placeholder="{$search.title|default=''}">
                                    <span class="input-group-btn"><a class="btn btn-default search-btn"><i class="fa fa-search"></i></a></span>
                                </div>
                            </div>
                        </form>
                    </div>
                </empty>
            </notempty>
        </div>
    </div>

    <!-- 多条件搜索 -->
    <notempty name="search_form_items">
        <form class="form form-inline search-form-items" method="get" action="{$search_url}">
            <style>
                .form-inline .form-group{
                    margin-right: 12px;
                    margin-bottom: 15px;
                }
                .form-inline .btn{
                    margin-bottom: 15px;
                }
                .form-group .right {
                   display: inline-block;
                }
                @media (max-width: 768px) {
                    .form-group .left {
                       width: 25%;
                    }
                    .form-group .right {
                        width: 70%;
                    }
                    .search-form-items .search-btn {
                        width: 100%;
                    }
                }
            </style>
            <volist name="search_form_items" id="form" key="k">
                <switch name="form.type">
                    <include file='[builderpath]/widget/text.html' type='' />
                    {// 单选框 }
                    <include file='[builderpath]/widget/radio.html' type='' />
                    {// 复选框 }
                    <include file='[builderpath]/widget/checkbox.html' type='' />
                    {// 下拉框 }
                    <include file='[builderpath]/widget/select.html' type='' />
                    {// 日期 }
                    <include file='[builderpath]/widget/date.html' type='' />
                    {// 日期时间 }
                    <include file='[builderpath]/widget/datetime.html' type='' />
                    {// 日期范围 }
                    <include file='[builderpath]/widget/dateranger.html' type='' />
                </switch>
            </volist>
            <button type="submit" class="btn btn-primary btn-pill search-btn"><i class="fa fa-search"></i> 搜索</button>
        </form>
    </notempty>

    <!-- 数据列表 -->
    <div class="builder-container">
        <div class="row">
            <div class="col-xs-12">
                <div class="builder-table">
                    <div class="panel panel-default table-responsive">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                    <?php if($hide_left_checkbox === false): ?>
                                        <th class="list-ids" width="30">
                                            <div class="checkbox-inline lyui-control lyui-checkbox m-l-xs">
                                                <label class="checkbox-label">
                                                    <input type="checkbox" class="check-all" >
                                                    <span class="lyui-control-indicator"></span>
                                                </label>
                                            </div>
                                        </th>
                                    <?php endif; ?>
                                    <volist name="table_column_list" id="column">
                                        <th width="<?php if ($column['width']) {echo $column['width'];} else {echo 'auto';} ?>">
                                            {$column.title|htmlspecialchars}
                                        </th>
                                    </volist>
                                </tr>
                            </thead>
                            <tbody>
                                <volist name="table_data_list" id="data">
                                    <tr>
                                        <?php if($hide_left_checkbox === false): ?>
                                            <td>
                                                <div class="checkbox-inline lyui-control lyui-checkbox m-l-xs">
                                                    <label class="checkbox-label">
                                                        <input class="ids" type="checkbox" value="{$data[$table_data_list_key]|default=''}" name="ids[]">
                                                        <span class="lyui-control-indicator"></span>
                                                    </label>
                                                </div>
                                            </td>
                                        <?php endif; ?>
                                        <?php foreach ($table_column_list as $column) :?>
                                            <td>
                                                <?php if ($column['name'] === 'right_button') : ?>
                                                    <?php foreach ($data['right_button'] as $rb) : ?>
                                                        <?php if(isset($rb['type']) && $rb['type'] === 'dropdown'): ?>
                                                            <div class="btn-group">
                                                                <button type="button" class="{$rb.class|default=''} dropdown-toggle" data-toggle="dropdown">
                                                                    {$rb.title|default=''}
                                                                    <span class="caret"></span>
                                                                </button>
                                                                <ul class="dropdown-menu" role="menu">
                                                                    <volist name="rb.dropdown" id="btn">
                                                                        <li><a class="{$btn.class}|default=''" href="{$btn.href|default=''}">{$btn.title}</a></li>
                                                                    </volist>
                                                                </ul>
                                                            </div>
                                                        <?php else: ?>
                                                            <a {$rb['attribute']|default=''}>{$rb['title']|default=''}</a>
                                                        <?php endif; ?>
                                                    <?php endforeach; ?>
                                                <?php else: ?>
                                                    {$data[$column['name']]|default=''}
                                                <?php endif; ?>
                                            </td>
                                        <?php endforeach; ?>
                                    </tr>
                                </volist>

                                <empty name="table_data_list">
                                    <tr class="builder-data-empty">
                                        <php>$tdcolspan = count($table_column_list)+1</php>
                                        <td class="text-center empty-info" colspan="{$tdcolspan}">
                                            <i class="fa fa-database"></i> 暂时没有数据<br>
                                            <span class="small">本系统由 <a target="_blank" href="{:C('WEBSITE_DOMAIN')}" class="text-muted">{:C('PRODUCT_TITLE')}</a> v{:C('CURRENT_VERSION')} 强力驱动</span>
                                        </td>
                                    </tr>
                                </empty>
                            </tbody>
                        </table>
                    </div>

                    <notempty name="table_data_page">
                        <ul class="pagination">{$table_data_page}</ul>
                    </notempty>
                </div>
            </div>
        </div>
    </div>

    {// 额外功能代码bottom }
    <?php if(isset($extra_html['bottom'])): ?>
        {$extra_html['bottom']}
    <?php endif; ?>
</div>
